package reflect;

/**
 * JDK5之后推出的一个特性:变长参数
 */
public class ArgsDemo {
    public static void main(String[] args) {
        dosome(1,"one");
        dosome(1,"one","two");
        dosome(1,"one","two","three");
        dosome(1,"one","two","three","two","three","two","three","two","three","two","three","two","three","two","three","two","three","two","three","two","three");
    }
    /*
        需要注意，变长参数只能是一个方法的最后一个参数。
        编译器最终会将变长参数改为数组
     */
    public static void dosome(int a,String... arg){
        System.out.println(arg.length);
    }
}
